﻿using Application.AppService.CMAppService;
using Application.AppService.CMKAppService;
using AutoMapper;
using Domain.Entity;
using Microsoft.AspNetCore.Mvc;

namespace UI.Controllers.Customization_Settings_客户化设置_.Human_resource_file_management_人力资源档案管理_
{
    public class CMKController : Controller
    {
        private readonly ICMKAppService cmkAppService;
        private readonly IMapper mapper;

        public CMKController(ICMKAppService cmkAppService, IMapper mapper)
        {
            this.cmkAppService = cmkAppService;
            this.mapper = mapper;
        }
        public IActionResult Index()
        {
            return View();
        }
        [HttpGet("GetCMK")]
        public async Task<IActionResult> GetCMK()
        {
            List<CMK> cmks=await cmkAppService.SelectCMKAsync();
            return Json(cmks);
        }
		[HttpPost("DeleteCMK")]
		public async Task<IActionResult> DeleteCMK(int id)
		{
			bool i = await cmkAppService.DeleteCMKAsync(id);
			return Json(i);
		}
		[HttpPost("AddCMK")]
		public async Task<IActionResult> AddCMK(CMK cmk)
		{
			bool i = await cmkAppService.AddCMKAsync(cmk);
			return Json(i);
		}
		[HttpGet("GetCMKById/{id}")]
		public async Task<IActionResult> GetCMKById(int id)
		{
			List<CMK> cmk = await cmkAppService.GetCMKAsyncById(id);
			return Json(cmk);
		}
	}
}
    